/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cocos2d.common;

/**
 *
 * @author KieuAnh
 */
public class CCRect
{
    private final CCPoint position;
    private final CCSize size;
    
    public CCRect()
    {
        this.position = new CCPoint();
        this.size = new CCSize();
    }
    
    public CCRect(CCPoint p, CCSize s)
    {
        this.position = p.copy();
        this.size = s.copy();
    }
    
    public CCRect(CCRect other)
    {
        this.position = other.position.copy();
        this.size = other.size.copy();
    }

    /**
     * @return the position
     */
    public CCPoint getPosition() {
        return position;
    }

    /**
     * @return the size
     */
    public CCSize getSize() {
        return size;
    }
    
    public CCRect copy()
    {
        return new CCRect(this);
    }
    
    public void toEmpty()
    {
        this.position.toZero();
        this.size.toZero();
    }
    
    public boolean isEmpty()
    {
        return this.size.getSquaredLength().getRaw() <= 0;
    }
}
